In computer science, a virtual machine (VM) is a portion of software that, when executed on appropriate hardware, creates an environment allowing the virtualization of an actual physical computer system. Each VM may function as a self-contained platform, running its own operating system (OS) and software applications (processes). Typically, a hypervisor manages allocation and virtualization of computer resources and performs context switching, as may be necessary, to cycle between various VMs.
A host machine (e.g., computer or server) is typically enabled to simultaneously run multiple VMs, where each VM may be used by a local or remote client. The host machine allocates a certain amount of the host's resources to each of the VMs. Each VM is then able to use the allocated resources to execute applications, including operating systems known as guest operating systems. The hypervisor virtualizes the underlying hardware of the host machine or emulates hardware devices, making the use of the VM transparent to the VM operating system or the remote client that uses the VM.
A VM may be allocated more than one CPU (called a virtual CPU or VCPU). Virtual symmetric multiprocessing (SMP) allows VMs to be deployed with multiple VCPUs to execute applications on the VM that spawn multiple processes and to execute multi-threaded applications on the VM that can take advantage of additional VCPUs.
In many cases, VMs with multiple VCPUs may be running on a host machine having multiple physical CPUs as well. Such a scenario can result in inefficiencies when a virtual device of a VM tries to communicate with the VM. A virtual device (sometimes referred to as an emulated device) of a VM exists entirely in software. A virtual device has an emulated device driver which acts as a translation layer between the OS running on the host machine (which manages the source device of the virtual device) and the guest OS running on the VM. The device level instructions directed to and from the virtual device are intercepted and translated by the hypervisor. Any device of the same type as that being emulated and recognized by the kernel of the host machine OS is able to be used as the backing source for the emulated drivers.
Currently, virtual devices exposed by the hypervisor to the VM can be programmed by the VM to trigger interrupts on any one of a VM's VCPUs. In the host machine multi-processor case, inefficiencies result when an interrupt is sent from a first host machine CPU to a VCPU of the VM that is running on a second (different) host machine CPU. This is because the first host machine CPU sending the interrupt must communicate with the second host machine CPU when the VCPU running on the second host machine CPU receives and processes the interrupt. This inter-host machine CPU communication requires notifications, which result in unnecessary resource consumption and time delays.